package main

import (
    "time"
    "log"
    "os"
)

var mainlog *log.Logger = nil
func setuplog() {
    f, err := os.OpenFile("/var/log/update_service.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0777)
    if err != nil {
        log.Fatal("open log file failed.", err)
        return
    }
    mainlog = log.New(f, "", log.Ldate|log.Ltime)
}

func main() {

    setuplog()

    g_config = loadConfig()

    mainlog.Println("start server...")
    go initListen(g_config.Listen)
    for {
        time.Sleep(1 * time.Second)
    }
    
}